#coding=utf-8

'''
Created on 2011-8-30

@author: chris
'''

PAGE_IDX = 'PAGE_INDEX' # 索引页标识
MISC_FROM_LIST = 'FROM_LIST'
MISC_COMPELETE_CHECK = 'CCHECK'
TYPE_KEY_PROP = 'KEY_PROPERTY'
TYPE_ENTRY = 'ENTRY'

class Property(object):
    '''
                 属性操作
    '''
    
    def __init__(self, prop, misc=None):
        self.prop = prop
        self.name = prop['name']
        self.desc = prop['desc']
        self.page = prop['page']
        self.type = prop['type']
        self.misc = misc
        
    def has_fake(self):
        return self.prop.has_key('fakeLength')
        
    def is_key(self):
        return self.type == TYPE_KEY_PROP
    
    def is_in_form_list(self):
        return self.page == PAGE_IDX and self.misc == MISC_FROM_LIST
    
    def is_check(self):
        return self.page != PAGE_IDX and self.misc == MISC_COMPELETE_CHECK
    
    def is_entry(self):
        return self.type == TYPE_ENTRY